package com.lorenzogao.customview


import android.animation.ObjectAnimator
import android.os.Bundle
import com.lorenzogao.customviewexample.R

import kotlinx.android.synthetic.main.activity_round_progress.*
import kotlinx.android.synthetic.main.layout_head.*

class RoundProgressActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_round_progress)
        setToolBar(toolbar, "圆形进度条")

        loadAnim()


        btnStart.setOnClickListener {
            loadAnim()
        }
    }


    public fun loadAnim() {
        val objectAnimator = ObjectAnimator.ofFloat(0f, 1f)
        objectAnimator.duration = 2000
        objectAnimator.addUpdateListener {
            roundProgress.setProgress(it.animatedValue as Float)
        }


        objectAnimator.start()


    }

}
